﻿<!DOCTYPE html>
<html>
<head>
    <script src="/js/header.js"></script>
    <link href="/lib/jquery/jquery-ui.min.css" rel="stylesheet" />
    <script src="/lib/jquery/jquery-ui.min.js"></script>
    <script src="/lib/bootstrap/tableExport.js"></script>
</head>
<body>
    <div class="data-wrap case" id="container">
        <div class="data-tool clearfix">
            <div class="pull-left form-inline ">
                <a class="btn btn-default btn-sm" data-href="/view/bankcard/addb2bspare.html" data-title="新增" data-width="452" data-height="550" onclick="return dialogOpen(this)"><span class="glyphicon glyphicon-plus"></span> 新增</a>
            </div>
            <div class="pull-right">
                <form class="form-inline" id="formSearch">
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">银行名称：</label>
                        <input class="form-control" name="bankName" type="text" />
                    </div>
                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">银行卡号：</label>
                        <input class="form-control" name="cardNumber" type="text" />
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">用戶名：</label>
                        <input class="form-control" name="cardName" type="text" />
                    </div>

                    <div class="input-group input-group-sm">
                        <label class="input-group-addon m5_l">启用状态：</label>
                        <select class="form-control" name="enableStatus">
                            <option value="">请选择</option>
                            <option value="2">已授权</option>
                            <option value="4">未授权</option>
                        </select>
                    </div>

                    <button type="button" class="btn btn-default btn-sm active" id="btnSearch"><span class="glyphicon glyphicon-search"></span> 搜索</button>
                </form>
            </div>
        </div>
        <div class="paging">
        </div>

    </div>
    <script type="text/x-dot-template" id="templatePager">
        <div class="data-body data-scroll">
            <div class="data-view">
                <div class="data-div-view table-responsive">
                    <table class="table table-hover table-striped table-bordered">
                        <thead>
                            <tr>
                                <th class="t_l wd125">银行名称</th>
                                <th class="t_l wd125">用户名</th>
                                <th class="t_l wd125">银行卡号</th>
                                <th class="t_l wd125">副卡号</th>
                                <th width="90">类型</th>
                                <th width="100">使用状态</th>
                                <th width="100">启用状态</th>
                                <th class="wd125">建立人员</th>
                                <th class="wd150">建立时间</th>
                                <th class="t_l">备注</th>
                                <th class="wd225">操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            {{? it.tData && it.tData.length>0}}
                            {{~it.tData :item:index}}
                            <tr>
                                <td class="t_l wd125">{{= item.bankName }}</td>
                                <td class="t_l wd125"><b>{{= item.cardName }}</b></td>
                                <td class="t_l wd125">{{= FlashPay.Util.SubCardNumber(item.cardNumber) }}</td>
                                <td class="t_l wd125">{{= FlashPay.Util.SubCardNumber(item.secCardNumber) }}</td>
                                <td width="90">{{= FlashPay.Util.GetCardTypeValue(item.cardType) }}</td>
                                <td width="100">{{= FlashPay.Util.GetCardStatusValue(item.usingStatus) }}</td>
                                <td width="100">{{= FlashPay.Util.GetSpareCardEnableStatusValue(item.enableStatus) }}</td>
                                <td class="wd125">{{= item.createName }}</td>
                                <td class="wd150">{{= item.createDate }}</td>
                                <td class="t_l">{{? item.remark==null }}{{?? }}{{= item.remark }}{{? }}</td>
                                <td class="wd225">
                                    {{? item.enableStatus==1 || item.enableStatus==2}}
                                    <a class="btn btn-warning btn-xs" data-confirm=' "{{= item.cardName }}" <br>确定要<span class="orange">收回授权</span>该银行卡？' data-href="/Bank/B2BUpdateAuthStatus?id={{= item.bcid}}&status=4">收回授权</a>
                                    {{?? }}
                                    <a class="btn btn-warning btn-xs" data-confirm=' "{{= item.cardName }}" <br>确定要<span class="orange">给予授权</span>该银行卡？' data-href="/Bank/B2BUpdateAuthStatus?id={{= item.bcid}}&status=2">给予授权</a>
                                    {{? }}

                                    {{? item.enableStatus==4}}
                                    <button type="button" class="btn btn-default btn-xs" data-href="/view/bankcard/editb2bspare.html?id={{= item.bcid}}" data-title="编辑 - {{= item.cardName }}" data-width="452" data-height="550" onclick="return dialogOpen(this)">
                                        <span class="glyphicon glyphicon-edit"></span> 编辑
                                    </button>
                                    {{? }}

                                    {{? item.receiptUID==0}}
                                    <a class="btn btn-danger btn-xs" data-confirm=' "{{= item.cardName }}" <br>确定要<span class="red">删除</span>该银行卡？' data-href="/Bank/B2BStockCardDelete?id={{= item.bcid}}&status=2">删除</a>

                                    {{?}}
                                </td>
                            </tr>
                            {{~}}
                            {{??}}
                            <tr class="noRecord">
                                <td colspan="11">暂无记录！</td>
                            </tr>
                            {{?}}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <!-- 必要的分页参数设置 -->
        <input type="hidden" id="TotalCount" value="{{=it.totalCount}}" />
    </script>

    <script type="text/javascript">

        $(function () {

            FlashPay.UI.DataAutoHeight();

            FlashPay.UI.DoSearch();

            $("#btnSearch").click(function () {
                window.currentPage = null;
                doSearch();
            });

        });

        $(document).keyup(function (event) {
            var keycode = event.which;
            if (keycode == 13) {
                FlashPay.UI.DoSearch();
            }
        });

        function doSearch() {
            FlashPay.UI.Pager(".paging", { templateId: "templatePager", pageSize: 15, ajax: { url: '/Bank/GetB2BStockPager' } });
        }

        $("input[name='CardNumberSearch']").change(function () {
            $("input[name='CardNumber']").val($("input[name='CardNumberSearch']").val());
        });
        
        function Tip_success(word) {
            FlashPay.UI.Tip_success(word);
        }

        function dialogOpen(obj) {
            FlashPay.UI.DialogOpen($(obj).data('href'), {
                title: $(obj).data('title'),
                width: $(obj).data('width'),
                height: $(obj).data('height')
            });
        }

    </script>
</body>
</html>